<?php
/**
 * @Descripttion:
 * @author Siebe
 * @date 2022-02-18 10:01
 */

namespace app\admin\validate;


class NavigationValidate extends BaseValidate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'name' => 'require|isNotEmpty',
        'icon' => 'require',
        'sort' => 'require|number|max:3',
        'status' => 'require|in:0,1|token'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name' => '请输入导航名称',
        'icon' => '请输入layui内置图标对应class',
        'sort' => '请输入排序值',
        'status' => '请选择开启或者禁用',
        'status.token' => '令牌错误'
    ];

    protected $scene = [
        'save' => ['name','icon','sort','status'],
        'update'  =>  ['name','icon','sort','status']
    ];
}